#include <string.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include "bst.h"
#include "entity.h"

int main(int argc, char** argv)
{
	srand((int)time(0));
	int rands, i = 0;
	char *tmp_name = "hihi";
	struct Bst *_pbst = initBst(allocData,
								dataCmp,
								freeData,
								copyData,
								printData);
	for(i=0;i<2;i++)
	{
		rands = 10*rand()/10000000+1;
		struct Data data;
		memset((void*)&data, 0, sizeof(data));
		data.num = rands;
		strcpy(data.name, tmp_name);
		insert(_pbst, &data);
		printf("%d\n", rands);
	}


	print(_pbst);
//	struct Data data;
//	memset((void*)&data, 0, sizeof(data));
	//removeMin(_pbst, _pbst->root, &data);
	printf("\n");
	printf("\n");

	//_pbst->printData(&data);
	printf("\n");
	printf("\n");

	//print(_pbst);
	printf("\n");
	printf("\n");

	struct Data data1;
	memset((void*)&data1, 0, sizeof(data1));
	data1.num = rands;
	strcpy(data1.name, "asdaa");
	printf("remove data: ");
	_pbst->printData(&data1);
	printf("\n");
	printf("\n");
	
	printf("\n");
	BOOL res = removeNode(_pbst, &data1);
	
	if(res==false)
		printf("not found\n");
	else
		print(_pbst);
	delBst(_pbst);

	return 0;
}
